<template>
  <div>
    <el-col :span="12">
      <el-card class="header layouts" style="height:200px;" shadow="always">
         <el-row class="title">任务状态分布</el-row>
         <el-row class="layouts_one">
          <div id="main"></div>
         </el-row>
      </el-card>
    </el-col>
  </div>
</template>

<script>
import * as echarts from 'echarts';
  export default {
    data() {
       return {

       }
    },
    mounted() {
      const myChart = echarts.init(document.getElementById('main'));
      // 绘制图表
      myChart.setOption({
      tooltip: {
        trigger: 'item'
      },
      legend: {
        orient: 'vertical',
        left: 'right',
        top: '110px'
      },
     series: [
        {
         name: '任务情况',
         type: 'pie',
         radius: '50%',
         data: [
            { value: 2300, name: '已经完结', itemStyle: { color: '#93D2F3' } }, // 设置“已经完结”的颜色
            { value: 150, name: '超期', itemStyle: { color: '#A36C67' } }, // 设置“超期”的颜色
            { value: 580, name: '预警', itemStyle: { color: '#FFCCC7' } }, // 设置“预警”的颜色
            { value: 600, name: '正常推进', itemStyle: { color: '#F4CE98' } } // 设置“正常推进”的颜色
          ],
      emphasis: {
        itemStyle: {
          shadowBlur: 10,
          shadowOffsetX: 0,
          shadowColor: 'rgba(0, 0, 0, 0.5)'
        }
      },
      label: {
          show: true,
          formatter: '{b}: {c}' // {b} 表示 name，{c} 表示 value
        }
      }]
   });
  }
}
</script>

<style lang="less" scoped>
// 第一个图标的card
.header {
  margin-bottom:15px;
  padding: 20px;
  .title {
    font-weight: bolder;
    padding-left: 12px;
    border-left: 6px solid rgb(124, 148, 237);
  }
  .item {
    margin-top: 30px;
    width: 154px;
    height: 80px;
    margin-left: 22px;
    color: white;
    // background-color: pink;
    border-radius: 5px;
  }
  .item_li {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }
  .item_li span:first-child {
      font-size: 24px;
      margin-top: 15px;
      margin-bottom: 5px;
      align-self: center;
    }

   .item_li span:last-child {
      display: flex;
      font-size: 16px;
    }
}

.layouts {
  margin-right: 15px;
  .layouts_one {
     display: flex;
     justify-content: center;
     align-items: center;
  }

}

/deep/ .el-col-4 {
  margin-right: 38px;
}



#main {
  height: 300px;
  width: 100%;
  margin-top: -50px;
}
</style>
